home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January / CHIP_CD_01_2007.iso / Hity z okladki / OrgPlus 6 SBE / ORGPL.CAB / countPage.js < prev    next >
Text File  |  2006-09-20  |  2KB  |  90 lines

  1. /**********************************************************
  2. *                                                         *
  3. * (C) Copyright 2002 - 2004,  Human Concepts (tm)         *
  4. *                                                         *
  5. ***********************************************************
  6. * File name: countPage.js                                 *
  7. * Author: Andrey Ponomarev                                *
  8. **********************************************************/
  9.  
  10.   window.onload = doInit
  11.   window.onresize = onResize
  12.  
  13.   function doInit()
  14.   {
  15.     var width = parseInt(document.body.clientWidth);
  16.     var col = parseInt(width * 2 / 3);
  17.  
  18.     ListObject.addColumn("<b>Title</b>", col) //Loc
  19.     ListObject.addColumn("<b>Count</b>", width - col) //Loc
  20.  
  21.     var obj = top.hcMain
  22.     if ( typeof (obj) == "object" && typeof (obj.onNavigatePageInit) != "undefined" )
  23.       obj.onNavigatePageInit()
  24.   }
  25.  
  26.   function onResize()
  27.   {
  28.     if( typeof(ListObject) == "object" )
  29.     {
  30.       var nWidth  = document.body.clientWidth - 2
  31.       var nHeight = document.body.clientHeight - 2
  32.  
  33.       if (document.body.scrollHeight > nHeight)
  34.         ListObject.SetWidth("100%");
  35.       else
  36.         ListObject.SetWidth(nWidth);
  37.     }
  38.   }
  39.  
  40.   function clearPage()
  41.   {
  42.     if (ListObject.m_created == true)
  43.     {
  44.       ListObject.RemoveList();
  45.     }
  46.  
  47.     top.hcMain.focus();
  48.   }
  49.  
  50.   function fillPage(group)
  51.   {
  52.     clearPage()
  53.  
  54.     if( typeof( group ) == "object" )
  55.     {
  56.       var ancObjs = group.getElementsByTagName("a")
  57.       for (i = 0; i < ancObjs.length; i++)
  58.       {
  59.         if (ancObjs(i).name == "Count")
  60.         {
  61.           var paramObjs = ancObjs(i).getElementsByTagName("param")
  62.           for (j = 1; j < paramObjs.length; j++)
  63.           {
  64.             var obj = paramObjs(j)
  65.             var str = obj.name
  66.             if (typeof(str) != "undefined" )
  67.             {
  68.               var strValue = ""
  69.               if ( typeof (obj.value) != "undefined" )
  70.                 strValue = obj.value
  71.  
  72.               if (ListObject.m_created == false)
  73.                 ListObject.createIn(document.body);
  74.  
  75.               ListObject.addItem(0, str, strValue);
  76.             }
  77.           } //for
  78.  
  79.           onResize();
  80.           top.hcMain.focus();
  81.           return;
  82.         }
  83.       } //for
  84.     } 
  85.  
  86.     onResize();
  87.     top.hcMain.focus();
  88.   }
  89.  
  90.